using System;
using System.Data;
using System.Collections;

namespace RMAS.DAL
{
    /// <summary>
    /// Summary description for QT_TABLERENT.
    /// </summary>
    public class QT_TABLERENTList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public QT_TABLERENTList()
    	{
	    }

		public void Add(QT_TABLERENT entity)
		{
            this.List.Add(entity);
		}

		public void Add(QT_TABLERENTList list)
		{	
			foreach(QT_TABLERENT entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual QT_TABLERENT this[int index]
		{
		    get
			{
				return (QT_TABLERENT)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual QT_TABLERENT Find(Int32 ID)
	{
	    foreach (QT_TABLERENT obj in this.List)
	    {
		if(obj.ID.ToString().ToUpper().Trim() == ID.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual QT_TABLERENTList FindListByID(Int32 ID)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
		    if(obj.ID.ToString().ToUpper().Trim() == ID.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual QT_TABLERENT FindByTableID(string TableID)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TableID.ToString().ToUpper().Trim() == TableID.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByTableName(string TableName)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TableName.ToString().ToUpper().Trim() == TableName.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByExBillID(string ExBillID)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.ExBillID.ToString().ToUpper().Trim() == ExBillID.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByTimeStart(DateTime TimeStart)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TimeStart.ToString().ToUpper().Trim() == TimeStart.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByTimeEnd(DateTime TimeEnd)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TimeEnd.ToString().ToUpper().Trim() == TimeEnd.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByTimeUse(DateTime TimeUse)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TimeUse.ToString().ToUpper().Trim() == TimeUse.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByTableMoney(decimal TableMoney)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TableMoney.ToString().ToUpper().Trim() == TableMoney.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByServiceMoney(decimal ServiceMoney)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.ServiceMoney.ToString().ToUpper().Trim() == ServiceMoney.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByMoneyBeforeChange(decimal MoneyBeforeChange)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.MoneyBeforeChange.ToString().ToUpper().Trim() == MoneyBeforeChange.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByChangeTable(string ChangeTable)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.ChangeTable.ToString().ToUpper().Trim() == ChangeTable.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByTimeMinutePause(Int32 TimeMinutePause)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.TimeMinutePause.ToString().ToUpper().Trim() == TimeMinutePause.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByUserName(string UserName)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.UserName.ToString().ToUpper().Trim() == UserName.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_TABLERENT FindByIDPOS(string IDPOS)
        {
	        foreach (QT_TABLERENT obj in this.List)
	        {
		        if(obj.IDPOS.ToString().ToUpper().Trim() == IDPOS.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual QT_TABLERENTList FindListByTableID(string TableID)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TableID.ToString().ToUpper().Trim() == TableID.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByTableName(string TableName)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TableName.ToString().ToUpper().Trim() == TableName.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByExBillID(string ExBillID)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.ExBillID.ToString().ToUpper().Trim() == ExBillID.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByTimeStart(DateTime TimeStart)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TimeStart.ToString().ToUpper().Trim() == TimeStart.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByTimeEnd(DateTime TimeEnd)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TimeEnd.ToString().ToUpper().Trim() == TimeEnd.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByTimeUse(DateTime TimeUse)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TimeUse.ToString().ToUpper().Trim() == TimeUse.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByTableMoney(decimal TableMoney)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TableMoney.ToString().ToUpper().Trim() == TableMoney.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByServiceMoney(decimal ServiceMoney)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.ServiceMoney.ToString().ToUpper().Trim() == ServiceMoney.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByMoneyBeforeChange(decimal MoneyBeforeChange)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.MoneyBeforeChange.ToString().ToUpper().Trim() == MoneyBeforeChange.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByChangeTable(string ChangeTable)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.ChangeTable.ToString().ToUpper().Trim() == ChangeTable.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByTimeMinutePause(Int32 TimeMinutePause)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.TimeMinutePause.ToString().ToUpper().Trim() == TimeMinutePause.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByUserName(string UserName)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.UserName.ToString().ToUpper().Trim() == UserName.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_TABLERENTList FindListByIDPOS(string IDPOS)
{
	try
	{
		QT_TABLERENTList List = new QT_TABLERENTList();
		foreach (QT_TABLERENT obj in this.List)
		{
			if(obj.IDPOS.ToString().ToUpper().Trim() == IDPOS.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(QT_TABLERENTList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public QT_TABLERENT Current
			{
				get
				{
					return (QT_TABLERENT)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (QT_TABLERENT)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}